package Info;

public class GoodsInfo {
    private String goodsNum;//编号
    private String goodsName;//名称
    private GoodsType goodsTy;//类别
    private int goodsCount;//数量
    private double goodsPrice;//价格

    public String getGoodsNum(){
        return goodsNum;
    }
    public void setGoodsNum(String goodsNum){
        this.goodsNum = goodsNum;
    }
    public String getGoodsName(){
        return goodsName;
    }
    public void setGoodsName(String goodsName){
        this.goodsName = goodsName;
    }
    public GoodsType getGoodsTy(){
        return goodsTy;
    }
    public void setGT(GoodsType goodsTy){
        this.goodsTy = goodsTy;
    }
    public void setGoodsCount(int goodsCount){
        if (goodsCount > 0){
            this.goodsCount = goodsCount;
        }else{
            System.out.println("库存数量异常，请联系管理员");
        }
    }
    public int getGoodsCount(){
        return goodsCount;
    }
    public double getGoodsPrice(){
        return goodsPrice;
    }
    public void setGoodsPrice(double goodsPrice){
        this.goodsPrice = goodsPrice;
    }
    public GoodsInfo(){
    }
    public GoodsInfo(String goodsName, GoodsType goodsTy, int goodsCount, double goodsPrice){
        this.goodsName = goodsName;
        this.goodsTy = goodsTy;
        this.setGoodsCount(goodsCount);
        this.goodsPrice = goodsPrice;
    }
    public void show(){
        System.out.println("商品名称：" + this.getGoodsName());
        System.out.println("所属类别：" + goodsTy.getTypeName());
        System.out.println("库存数量：" + this.getGoodsCount());
        System.out.println("商品售价：" + this.getGoodsPrice());
        System.out.println("商品总价：" + this.getGoodsPrice()*this.getGoodsCount());

    }
    public static void main(String[] args) {
        GoodsType gt = new GoodsType("","洗发水");
        GoodsInfo g1=new GoodsInfo("潘婷洗发水400ml",gt,16,40.5);
        g1.show();
        System.out.println("======================");
        GoodsInfo g2=new GoodsInfo("蜂花洗发水250ml",gt,2,5.0);
        g2.show();
    }
}
